﻿@{
    ViewData["Title"] = "用户管理";
}
@model LoginViewModel
<div class="panel panel-default">
    <div class="form-content">
        <div class="form-body">
            <div class="row" id="filter" data-toggle="form" data-field="User" data-grid="#grid" data-filterable="true">
                <input data-field="name" data-size="4,0,12" data-logic="or" data-operator="contains" />
                <button data-button="query">查询</button>
                <button data-button="clear">清除条件</button>
                <div class="pull-right" style="padding-right:15px;">
                    <button data-button="add" data-popup="Edit">新 增</button>
                </div>
            </div>
            <div id="grid" data-toggle="grid" data-form="#filter" node="grid" data-related="#_PopupDetail">
                <div node="columns" node-type="array">
                    @*<span data-field="image" data-title="用户图片" data-type="image"></span>*@
                    <span data-field="userName" data-title="用户名"></span>
                    <span data-field="name" data-title="用户姓名"></span>
                    <span data-field="alias" data-title="昵称/别名"></span>
                    <span data-field="type" data-title="用户类型" data-data-from="cache.authorizeType"></span>
                    <span data-field="phoneNumber" data-title="手机号码"></span>
                    <span data-field="email" data-title="邮箱"></span>
                    <span data-field="description" data-title="备注说明"></span>
                    <span data-field="state" data-title="状态" data-data-from="cache.dataState"></span>
                    <span data-field="createdOn" data-title="创建时间" data-type="datetime"></span>
                </div>
                <span node="dataSource">
                    <span node="transport">
                        <span node="read" data-url="/api/Users?$select=id,name,userName,alias,type,image,phoneNumber,email,state,createdOn,description">
                        </span>
                    </span>
                    <span node="sort" data-field="userName" data-dir="asc"></span>
                </span>
            </div>
        </div>
    </div>
</div>

<div id="_PopupDetail" data-toggle="popup" data-type="Detail" data-title="用户信息">
    <div class="popup-content" data-toggle="form" data-field="User" data-detailable="true" data-size="12,4,8">
        <div class="popup-body">
            <div class="form-content">
                <div class="form-body">
                    @*<div data-field="image" data-label="用户图片" data-type="img" data-business-type="User" data-single="true"></div>*@
                    <span data-field="userName" data-label="用户名"></span>
                    <span data-field="name" data-label="用户姓名"></span>
                    <span data-field="alias" data-label="用户别名"></span>
                    <span data-field="type" data-label="用户类型" data-data-from="cache.authorizeType"></span>
                    <span data-field="phoneNumber" data-label="手机号码"></span>
                    <span data-field="email" data-label="电子邮件"></span>
                    <span data-field="state" data-label="状态" data-data-from="cache.dataState"></span>
                    <span data-field="description" data-label="备注说明"></span>
                </div>
            </div>
        </div>
        <div class="popup-footer text-right">
            <button data-button="edit" data-popup="Edit">编 辑</button>
            <button data-button="close">关 闭</button>
        </div>
    </div>
</div>

<div id="_PopupEdit" data-toggle="popup" data-type="Edit" data-title="用户信息" data-related="#filter" data-size="large">
    <div class="popup-content" data-toggle="form" data-field="User" data-editable="true" data-url="/api/Users" data-size="12,3,7">
        <div class="popup-body">
            <div class="form-content">
                <div class="form-body">
                    <input data-field="userName" data-label="用户名" required />
                    <input data-field="name" data-label="用户姓名" required />
                    <input data-field="alias" data-label="用户别名" />
                    <span data-field="type" data-label="用户类型" required type="radio" data-with-group="true" data-data="#:cache.authorizeType" data-value="Internal"></span>
                    <input data-field="phoneNumber" data-label="手机号码" />
                    <input data-field="email" data-label="电子邮件" />
                    <span data-field="state" data-label="状态" required type="radio" data-with-group="true" data-data="#:cache.dataState" data-value="Available"></span>
                    <textarea data-field="description" data-label="备注说明" rows="3" data-multiple="true"></textarea>
                    @*<input data-field="image" data-label="用户图片" data-with-attachments="true" data-business-type="User" data-single="true" type="file" data-role="kendoUpload" data-file-size="1024" data-file-extension=".jpg,.jpeg,.png" />*@
                </div>
            </div>
        </div>
        <div class="popup-footer text-right">
            <button data-button="post" data-success-text="新增成功"></button>
            @*<button data-button="put" data-success-text="保存成功"></button>*@
            @*<button data-button="post" data-success-text="设置成功" data-action="User.onSetLevel">设置用户级别</button>*@
            <button data-button="delete" data-success-text="删除成功"></button>
            <button data-button="close">关 闭</button>
        </div>
    </div>
</div>